package com.hunttown.mes.rpc.domain.enums.travel;

import java.util.HashMap;
import java.util.Map;

/**
 * 路线类型：1通勤 2旅游 3定制 4接驳 5约车 6订车
 * created by wangjunfu on 2018/11/6
 */
public enum TravelLineTypeEnum {
    BUS(1, "通勤"),   //针对企业
    TRAVEL(2, "旅游"),//旅游专线
    CUSTOMIZED(3, "定制"),    //专门针对某企业做的定制化服务
    JBO(4, "接驳"),   //景区接驳
    YUE(5, "约车"),   //约车
    BAN(6, "订车");   //客户自主下单

    private final int key;
    private final String value;

    TravelLineTypeEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    // 根据key获取枚举
    public static String getEnumByKey(int key) {
        String value = "";

        for (TravelLineTypeEnum temp : TravelLineTypeEnum.values()) {
            if (temp.getKey() == key) {
                value = temp.getValue();
            }
        }

        return value;
    }

    // 将枚举组成Map
    public static Map<Integer, String> getEnumList() {
        Map<Integer, String> map = new HashMap<>();

        for (TravelLineTypeEnum temp : TravelLineTypeEnum.values()) {
            map.put(temp.getKey(), temp.getValue());
        }

        return map;
    }

    public int getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
